import { observable, action } from 'mobx'
import http from 'utils/http'

class ArticleStore {
  @observable info = {}
  @observable list = []
  @observable generalList = []

  @action
  async getInfo(id) {
    const res = await http.get('imageText/info', { id })
    if (res.code === 1) {
      this.info = res.data
    }
  }

  @action
  async getList(gid) {
    const res = await http.get('imageText/list', { gid, page: 1, pageSize: 100 })
    if (res.code === 1) {
      this.list = res.data.data
    }
  }

  @action
  async getGeneralList(gid) {
    const res = await http.get('articles/list', { gid, page: 1, pageSize: 100 })
    if (res.code === 1) {
      this.generalList = res.data.data
    }
  }
}


const articleStore = new ArticleStore()

export default articleStore
export { ArticleStore }

